package com.cai.mvvm.viewmodel;

import androidx.lifecycle.MutableLiveData;

import com.cai.mvvm.model.MainModel;
import com.mvvm.library.base.BaseObserver;
import com.mvvm.library.base.BaseViewModel;

import java.util.List;

/**
 * @创建时间：2023/3/1
 * @作者：小蔡
 * @功能介绍：
 */
public class MainViewModel extends BaseViewModel {
    public MutableLiveData<List<String>> list = new MutableLiveData<>();
    public MutableLiveData<String> data = new MutableLiveData<>();

    public void setList(){
        MainModel.getInstance().getItemList(new BaseObserver<List<String>>() {
            @Override
            public void onSuccess(List<String> o) {
                list.setValue(o);
            }

            @Override
            public void onError(String msg) {

            }
        });

    }

    public void setData(){
        data.setValue("你好");
    }
}
